package concurrency;

public class Fat {
    private static int sCounter = 0;

    private final int mId = sCounter++;

    private volatile double mD;  // Prevent optimization

    public Fat() {
        // Expensive, interruptible operation
        for (int i = 1; i < 10000; i++) {
            mD += (Math.PI + Math.E) / (double) i;
        }
    }

    @Override
    public String toString() {
        return "Fat [mId=" + mId + ", mD=" + mD + "]";
    }
}
